﻿@using giaoxuhaison.Models;
@{
    Layout = null;
}

@{
    var lstImg = (List<ImagesVideosAll>)ViewData["lstImg"];
    
}

<div class="PanelContent" id="HappyLink">
    <div id="demo" style="overflow: hidden; width: 100%; height: 200px;"> 
        <table cellspace="0" align="left" bgcolor="#ffffff" border="0" cellpadding="0">
            <tbody><tr> 
                <td id="demo1" valign="top" width="100%"> 
                <table align="center" bgcolor="#c4c4c4" border="0" cellpadding="3" cellspacing="0">
                    <tbody>
                    <tr bgcolor="#ffffff" valign="top">
                            <!--phan nay bat dau load hinh chay len-->
                            <!--load tu db-->
                            @foreach (var item in lstImg)
                            {
                                <td align="middle"> 
	                                <table border="0" cellpadding="0" cellspacing="0">
		                                <tbody><tr>
			                                <td align="middle">
				                                <a href="@Url.Action("ImgDetail", "Categories", new { ImgVideoID = item.ImgVideoID, GroupID =item.GroupID })" >
                                                    @if (!string.IsNullOrEmpty(item.IntroImageUrl))
                                                    {
                                                        <img src="@Url.Content(item.IntroImageUrl)" title='@item.Subject'/>
                                                    }
                                                    else
                                                    {
                                                        <img src="~/Images/photo_not_available.png" />
                                                    }       
                                                    <br />
                                                    <i style="font-size:11px;">@item.Subject</i>
                                                </a>
                                                
			                                </td>
		                                 </tr>
	                                </tbody></table>
                                </td>
                            }
                            <!--do hinh it nen them 1 doan, khi nao hinh nhieu thi bo doan nay ra-->
                            @foreach (var item in lstImg)
                            {
                                <td align="middle"> 
	                                <table border="0" cellpadding="0" cellspacing="0">
		                                <tbody><tr>
			                                <td align="middle">
				                                <a href="@Url.Action("ImgDetail", "Categories", new { ImgVideoID = item.ImgVideoID, GroupID =item.GroupID })" >
                                                    @if (!string.IsNullOrEmpty(item.IntroImageUrl))
                                                    {
                                                        <img src="@Url.Content(item.IntroImageUrl)" title='@item.Subject'/>
                                                    }
                                                    else
                                                    {
                                                        <img src="~/Images/photo_not_available.png" />
                                                    }       
                                                    <br />
                                                    <i style="font-size:11px;">@item.Subject</i>
                                                </a>
                                                
			                                </td>
		                                 </tr>
	                                </tbody></table>
                                </td>
                            }
                            
                            <!--end load hinh-->
		            </tr>
                    </tbody></table>
                </td>
                <td id="demo2" valign="top" width="19"> 
                    <table align="center" bgcolor="#c4c4c4" border="0" cellpadding="3" cellspacing="0">
                        <tbody><tr bgcolor="#ffffff" valign="top">
                        <!--phan nay bat dau load hinh chay len, bat buoc phai co 6 hinh-->
                        <!--load tu db-->
                        @foreach (var item in lstImg)
                        {
                            if (string.IsNullOrEmpty(item.IntroImageUrl))
                            {
                                item.IntroImageUrl = "~/Images/photo_not_available.png";
                            }
                            <td align="middle"> 
	                            <table border="0" cellpadding="0" cellspacing="0">
		                            <tbody><tr>
			                            <td align="middle">
				                            <a href="@Url.Action("ImgDetail", "Categories", new { ImgVideoID = item.ImgVideoID, GroupID =item.GroupID })" >
                                                <img src="@Url.Content(item.IntroImageUrl)" title='@item.Subject'/>                                                 
                                                <br />
                                                <i style="font-size:11px;">@item.Subject</i>
                                            </a>                                            
			                            </td>
		                                </tr>
	                            </tbody></table>
                            </td>
                        }
                        <!--do hinh it nen them 1 doan, khi nao hinh nhieu thi bo doan nay ra-->  
                        @foreach (var item in lstImg)
                        {
                            if (string.IsNullOrEmpty(item.IntroImageUrl))
                            {
                                item.IntroImageUrl = "~/Images/photo_not_available.png";
                            }
                            <td align="middle"> 
	                            <table border="0" cellpadding="0" cellspacing="0">
		                            <tbody><tr>
			                            <td align="middle">
				                            <a href="@Url.Action("ImgDetail", "Categories", new { ImgVideoID = item.ImgVideoID, GroupID =item.GroupID })" >
                                                <img src="@Url.Content(item.IntroImageUrl)" title='@item.Subject'/>                                                 
                                                <br />
                                                <i style="font-size:11px;">@item.Subject</i>
                                            </a>                                            
			                            </td>
		                                </tr>
	                            </tbody></table>
                            </td>
                        }
                        <!--end load hinh-->

		        </tr>
                </tbody></table>
            </td>
              </tr>
              </tbody></table>
              <br>
    </div>
</div>

<script language="javascript">
    var speed = 20;
    demo2.innerHTML = demo1.innerHTML;
    function Marquee() {
        if (demo2.offsetWidth - demo.scrollLeft <= 0)
            demo.scrollLeft -= demo1.offsetWidth;
        else {
            demo.scrollLeft++;
        }
    }
    var MyMar = setInterval(Marquee, speed)
    demo.onmouseover = function () { clearInterval(MyMar) }
    demo.onmouseout = function () { MyMar = setInterval(Marquee, speed) }
</script>
